Networking and Communications

Networking and Communications #

Intro #

In this page I will document the process of trying out the wifi connection functions on the ESP32C3 board.


Hardware #

I continued with the last board I made for Input/Output device since it have all the function needed. The goal is to control the on board Neopixel and the connected OLED screen via internet, as well as get the button state on the board, thus making a REST API system.

Programming #

I used the example code provided by Kris as the starting point. The examples can be found in this Github repo:

I prioritized adding the OLED display functions first, as this feature will greatly assist in the debugging process afterwards. To display the content that originally printed to serial on the screen, I write a short function that printed on both, and replaced the original serial print output codes with the new one.

void print_all(String content){
  display.println(content);
  Serial.println(content);
  display.display();
}

Then I changed the original digitalWrite code to the Neopixel controls.

if (query == "/turnLedOn") {
    response = "Turning LED on.";
    //digitalWrite(led, HIGH);
    pixels.setPixelColor(0, pixels.Color(255, 255, 255));
    pixels.show();

    display.setCursor(0,0);
    display.clearDisplay();
    display.println("Turning LED on");
    display.display();
} 

Result #

Here’s the result that I got.

All in all, it’s a simple try of the internet connectivity on the ESP32 board. Although I would have liked to explore this further, time constraints limited my progress. However, I plan to continue working on transmitting data gathered from the input devices through internet and visualize them during the upcoming Interface and Application week.